<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
<script type="text/javascript">
    //数组的解构
    const F4 = ["小沈阳", "刘能", "赵四", "宋小宝"];
    // 声明多个变量
    let [xiao, liu, zhao, song] = F4;
    console.log(xiao);
    console.log(liu);
    console.log(zhao);
    console.log(song);

    //对象的解构
    const zhaob = {
        name: "赵本山",
        age: "no",
        xiaopin: function () {
            console.log("我会小品");
        },
    };
    console.log("-------------------------")
    let { name, age, xiaopin } = zhaob;
    console.log(xiaopin);
    console.log(name);
    console.log(age);

    // ES6语法：变量拼接 ${变量名字}，注意：使用变量拼接语法是必须使用反引号
    let n1 = "大锤";
    let n2 = `${n1}在欣赏风景`;
    console.log(n2);

    // ES6语法支持在大括号当中定义函数
    let user = {  // 这种写法本质可以看成是一个对象
        name: "大锤",

        // 定义方法
        run(msg){
            console.log(msg);
        }
    }

    console.log(user);
    user.run("ES6语法支持在大括号当中定义函数");


</script>
</html>